#include "e2d/core/render/components.h"
#include "e2d/core/Entity.h"

using namespace e2d::render;

std::vector<std::string> Components::m_Labels= {

    e2d::CameraView::_Label_(),
    e2d::CameraViewEdit::_Label_(),
    e2d::LightSource::_Label_(),
    e2d::FixedMeshRender::_Label_(),
    e2d::SkinnedMeshRender::_Label_(),
    e2d::ImageQuad::_Label_(),
    e2d::Texts::_Label_(),
    e2d::SkyboxView::_Label_(),
    e2d::LightEnv::_Label_(),
};

   
bool Components::AddComponent(e2d::Entity* entity,const  ComponentType& type)
{
	bool flag{ 0 };

    flag |= entity->AddComponentFromType<e2d::CameraView>(type);
    flag |= entity->AddComponentFromType<e2d::CameraViewEdit>(type);
    flag |= entity->AddComponentFromType<e2d::LightSource>(type);
    flag |= entity->AddComponentFromType<e2d::FixedMeshRender>(type);
    flag |= entity->AddComponentFromType<e2d::SkinnedMeshRender>(type);
    
    flag |= entity->AddComponentFromType<e2d::ImageQuad>(type);
    flag |= entity->AddComponentFromType<e2d::Texts>(type);
    flag |= entity->AddComponentFromType<e2d::SkyboxView>(type);
    flag |= entity->AddComponentFromType<e2d::LightEnv>(type);
    return flag;
}

bool Components::CopyComponents(const e2d::Entity* source, e2d::Entity* target)
{
    bool flag{0};

    flag|=target->CopyComponent<e2d::CameraView>(source);
    flag|=target->CopyComponent<e2d::CameraViewEdit>(source);
    flag|=target->CopyComponent<e2d::LightSource>(source);
    flag|=target->CopyComponent<e2d::FixedMeshRender>(source);
    flag|=target->CopyComponent<e2d::SkinnedMeshRender>(source);
    // Try Move to the fui render
    flag|=target->CopyComponent<e2d::ImageQuad>(source);
    flag |= target->CopyComponent<e2d::Texts>(source);
    flag |= target->CopyComponent<e2d::SkyboxView>(source);
    flag |= target->CopyComponent<e2d::LightEnv>(source);
    return flag;
}
